#ifndef _GRAPH_H_
#define _GRAPH_H_

#include"Edge.h"

class Graph{

protected:
	int	vertex_num;
	int edge_num;
	bool* visited;
	int* indegree;
	int* outdegree;

protected:
	void IncEdge(int from, int to);
	void DecEdge(int from, int to);

public:
	Graph(int vertex_num);
	Graph(const Graph& g);
	Graph& operator = (const Graph& g);
	virtual ~Graph();

	int GetVerticesNum();
	int GetEdgeNum();

	void ClearVisitState();

	virtual void Visit(int vertex) = 0;
	virtual Edge GetFirstEdge(int vertex) = 0;
	virtual Edge GetNextEdge(Edge pre_edge) = 0;
	virtual bool SetEdge(int from, int to, int weight = 1) = 0;
	virtual bool DelEdge(int from, int to) = 0;
	virtual bool IsEdge(Edge edge) = 0;

	virtual void DumpVertexInfo(std::ostream& os, int index) = 0;
	virtual void DumpGraph(std::ostream& os) = 0;


	void DeepFirstSearch(int vertex);
	void BroadFirstSearch(int vertex);
	void DoDeepFirstTraverse();
	void DoBroadFirstTraverse();

};

#endif // _GRAPH_H_
